//
//  ContactRequestLogic.m
//  AAIM
//
//  Created by awh on 2019/12/10.
//  Copyright © 2019年 AAIM. All rights reserved.
//

#import "ContactRequestLogic.h"
//搜索好友
#define searchFriendURL @"/friend/select"
//手机号/账号/用户id
#define searchQueryFriendURL @"/friend/query"

//联系人
#define FriendlistFriendURL @"/friend/list"
//s好友删除
#define deleteFriendURl @"/friend/delete"
//好友同意操作
#define authFriendURL @"/friend/authFriend"
//新的好友
#define addListURL @"/friend/addList"
//好友申请
#define searchFriend @"/friend/addF"
//拉黑/移除好友设置，备注
#define joinBlackList @"/friend/update"
//黑名单列表
#define getBlackList @"/friend/blockList"
//举报用户或群
#define reportUserOrGroup @"/user/report"
//通讯好友
#define addressBookFriend @"/friend/address"

//群接口
//成员申请
#define Group_authlist @"/contact/authList"
//共同群组
#define Group_commonGroup @"/contact/commonGroup"
//创建群组
#define Group_creatGroup @"/contact/creatGroup"
//好友聊天拉群
#define Group_chatCreatGroup @"/contact/sessionCreatGroups"
//删除群成员
#define Group_deleteMember @"/contact/deleteMember"
//群组
#define Group_getGroups @"/contact/getGroups"
//群主审核
#define Group_groupAudit @"/contact/groupAudit"
//群组设置展示
#define Group_groupSet @"/contact/groupSet"
//群设置保存
#define Group_groupUpdate @"/contact/groupUpdate"
//好友推荐/二维码/口令进群
#define Group_joinGroup @"/contact/joinGroup"
//群昵称搜索
#define Group_query @"/contact/query"
//查询群成员
#define Group_queryMember @"/contact/queryMember"
//查询群昵称
#define Check_GroupName @"/contact/queryGroupVo"
//w二维码跳转
#define Group_CodeJoin @"/contact/groupCode"

//退出群聊
#define Group_quitGroup @"/contact/quitGroup"

//群昵称搜索
#define Public_query @"/public/list"

@implementation ContactRequestLogic
+(void)requestSearchFriendResultsWithfuuid:(NSString*)fuuid Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:fuuid forKey:@"fuuid"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:searchFriendURL method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestSearchFriendQueryWithQuery:(NSString*)query Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:query forKey:@"query"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:searchQueryFriendURL method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}

+(void)requestFriendListWithPage:(NSString*)Page Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    //    [paramentdic setValue:Page forKey:@"Page"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:FriendlistFriendURL method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestDeleteFriendWithFuuid:(NSString*)Fuuid Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:Fuuid forKey:@"fuuid"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:deleteFriendURl method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}

+(void)requestBlackListSuccess:(void (^)(NSDictionary * _Nonnull))success failure:(void (^)(NSString * _Nonnull))failure{
    
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:getBlackList method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}

+(void)requestJoinBlackListFriendWithFuuid:(NSString *)fuuid withBlock:(NSString *)block withDescribe:(NSString *)describe withRemark:(NSString *)remark Success:(void (^)(NSDictionary * _Nonnull))success failure:(void (^)(NSString * _Nonnull))failure{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:fuuid forKey:@"fuuid"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    
        [paramentdic setValue:describe forKey:@"describe"];

        [paramentdic setValue:remark forKey:@"remark"];

    [paramentdic setValue:block forKey:@"block"];  //0、不拉黑；1、拉黑
    
    [[NetWorkTool shareInstance]requestWithPath:joinBlackList method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
    
}

+(void)requestAgreedFriendWithID:(NSString*)ID isAgree:(NSString*)isAgree Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:ID forKey:@"fuuid"];
    [paramentdic setValue:isAgree forKey:@"isAgree"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:authFriendURL method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestNewFriendsListSuccess:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:addListURL method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestAddFriendWithContent:(NSString*)content fuuid:(NSString*)fuuid groupid:(NSString*)groupid source:(NSString*)source  Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    if (content &&![CommonTools isEmpty:content]) {
     [paramentdic setValue:content forKey:@"content"];
    }
    
    [paramentdic setValue:fuuid forKey:@"fuuid"];
    [paramentdic setValue:groupid forKey:@"groupid"];
    [paramentdic setValue:source forKey:@"source"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:searchFriend method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
    
}

+(void)reportUserOrGroupWithContent:(NSString *)content withFuuid:(nonnull NSString *)fuuid withImgUrl:(nonnull NSString *)url groupid:(nonnull NSString *)groupId Success:(nonnull void (^)(NSDictionary * _Nonnull))success failure:(nonnull void (^)(NSString * _Nonnull))failure{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
   
    [paramentdic setValue:content forKey:@"content"];
    
    if (groupId) {
        [paramentdic setValue:groupId forKey:@"groupid"];
    }
    if (fuuid){
        [paramentdic setValue:fuuid forKey:@"fuuid"];
    }
    [paramentdic setValue:url forKey:@"imgUrl"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:reportUserOrGroup method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
    
}

+(void)uploadAddressBookWith:(NSString *)phoneList Success:(void (^)(NSDictionary * _Nonnull))success failure:(void (^)(NSString * _Nonnull))failure{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:phoneList forKey:@"phoneList"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:addressBookFriend method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}


#pragma mark- 群接口
+(void)requestGroupAuthListWithGroupid:(NSString*)groupid Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:groupid forKey:@"gid"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:Group_authlist method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestCommonGroupWithFuuid:(NSString*)fuuid Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:fuuid forKey:@"fuuid"];
    [[NetWorkTool shareInstance]requestWithPath:Group_commonGroup method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestCreateGroupWithGroupName:(NSString*)GroupName isSelect:(NSString*)isSelect Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:GroupName forKey:@"groupName"];
    [paramentdic setValue:isSelect forKey:@"isSelect"];
    [[NetWorkTool shareInstance]requestWithPath:Group_creatGroup method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
    
}
+ (void)requestInviteFriendsCreateGroupWithGroupName:(NSString *)GroupName withInviteFuuids:(NSString *)fuuids isSelect:(NSString *)isSelect Success:(void (^)(NSDictionary * _Nonnull))success failure:(void (^)(NSString * _Nonnull))failure{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
//       [paramentdic setValue:GroupName forKey:@"groupName"];
//       [paramentdic setValue:@"0" forKey:@"isSelect"];
    [paramentdic setValue:fuuids forKey:@"fuuids"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
       [[NetWorkTool shareInstance]requestWithPath:Group_chatCreatGroup method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
           if (res.isSuccess) {
               success(res.rawdata);
           }else
           {
               failure(res.message);
           }
       }];
}
+(void)requestDeleteGroupMembersWithGroupid:(NSString*)groupid joinGroupIds:(NSString*)joinGroupIds Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:groupid forKey:@"groupId"];
    [paramentdic setValue:joinGroupIds forKey:@"fuuids"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:Group_deleteMember method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestGetGroupsListSuccess:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    
    [[NetWorkTool shareInstance]requestWithPath:Group_getGroups method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}

+(void)requestGroupCodePUshWithGroupCode:(NSString*)fuuid Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure;
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:fuuid forKey:@"groupCode"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:Group_CodeJoin method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}

+(void)requestGroupsManagerAuditWithisPass:(NSString*)isPass withUserFuuid:(nonnull NSString *)fuuid joinGroupId:(nonnull NSString *)joinGroupId Success:(nonnull void (^)(NSDictionary * _Nonnull))success failure:(nonnull void (^)(NSString * _Nonnull))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:isPass forKey:@"isPass"];
    [paramentdic setValue:joinGroupId forKey:@"groupId"];
    [paramentdic setValue:fuuid forKey:@"fuuid"];
    [[NetWorkTool shareInstance]requestWithPath:Group_groupAudit method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestShowGroupSetWithGroupid:(NSString*)groupid Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:groupid forKey:@"groupId"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:Group_groupSet method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestSaveGroupSetWithGroupId:(NSString*)groupId GroupCode:(NSString*)groupCode groupName:(NSString*)groupName groupNotice:(NSString*)groupNotice groupQr:(NSString*)groupQr  isAdd:(NSString*)isAdd isChat:(NSString*)isChat isDis:(NSString*)isDis isGroupadd:(NSString*)isGroupadd isGroupmember:(NSString*)isGroupmember isPrivatechat:(NSString*)isPrivatechat isSelect:(NSString*)isSelect isStick:(NSString*)isStick Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    if (groupId) {
       [paramentdic setValue:groupId forKey:@"groupId"];
    }
    if (groupCode&&![CommonTools isEmpty:groupCode]) {
     [paramentdic setValue:groupCode forKey:@"groupCode"];
    }
    if (groupName) {
      [paramentdic setValue:groupName forKey:@"groupName"];
    }
    if (groupNotice &&![CommonTools isEmpty:groupNotice]) {
       [paramentdic setValue:groupNotice forKey:@"groupNotice"];
    }
    if (groupQr) {
        [paramentdic setValue:groupQr forKey:@"groupQr"];
    }
    if (isAdd) {
        [paramentdic setValue:isAdd forKey:@"isAdd"];
    }
    if (isChat) {
        [paramentdic setValue:isChat forKey:@"isChat"];
    }
    if (isDis) {
      [paramentdic setValue:isDis forKey:@"isDis"];
    }
    if (isGroupadd) {
        [paramentdic setValue:isGroupadd forKey:@"isGroupadd"];
    }
    if (isGroupmember) {
       [paramentdic setValue:isGroupmember forKey:@"isGroupmember"];
    }
    if (isPrivatechat) {
       [paramentdic setValue:isPrivatechat forKey:@"isPrivatechat"];
    }
    if (isSelect) {
        [paramentdic setValue:isSelect forKey:@"isSelect"];
    }
    if (isStick) {
        [paramentdic setValue:isStick forKey:@"isStick"];
    }    
    [[NetWorkTool shareInstance]requestWithPath:Group_groupUpdate method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestJoinGroupSetWithGroupId:(NSString*)groupId GroupCode:(NSString*)groupCode fuuids:(NSString*)fuuids reason:(NSString*)reason type:(NSString*)type Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    
    if ([type isEqualToString:@"1"]) {
        if (![CommonTools isEmpty:groupCode]) {
            [paramentdic setValue:groupCode forKey:@"groupCode"];
        }
        if (![CommonTools isEmpty:reason]) {
            [paramentdic setValue:reason forKey:@"reason"];
        }
        [paramentdic setValue:fuuids forKey:@"fuuids"];
        
        
    }
    if ([type isEqualToString:@"2"]) {
      if (![CommonTools isEmpty:groupCode]) {
            [paramentdic setValue:groupCode forKey:@"groupCode"];
        }
    }
    if ([type isEqualToString:@"1"] ||[type isEqualToString:@"3"]) {
       [paramentdic setValue:groupId forKey:@"groupId"];
    }
    [paramentdic setValue:UserFuuid forKey:@"uuid"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    
    [paramentdic setValue:type forKey:@"type"];
    
    [[NetWorkTool shareInstance]requestWithPath:Group_joinGroup method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestSearchGroupNameWithQuery:(NSString*)query Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:query forKey:@"query"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:Group_query method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestGroupqueryMembersWithgroupId:(NSString*)groupId Query:(NSString*)query page:(NSString*)page Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:groupId forKey:@"groupId"];
    if (![CommonTools isEmpty:query]) {
     [paramentdic setValue:query forKey:@"query"];
    }
    if (![CommonTools isEmpty:page]) {
       [paramentdic setValue:page forKey:@"page"];
    }
    
    
    [[NetWorkTool shareInstance]requestWithPath:Group_queryMember method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
}
+(void)requestQuitGroupWithGroupid:(NSString*)groupid Success:(void (^)(NSDictionary *Dict))success failure:(void (^)(NSString* errMsg))failure
{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
    [paramentdic setValue:groupid forKey:@"groupId"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
    [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestWithPath:Group_quitGroup method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
        if (res.isSuccess) {
            success(res.rawdata);
        }else
        {
            failure(res.message);
        }
    }];
    
}

+(void)requestCheckGroupNameWithGroupID:(NSString *)groupID Success:(void (^)(NSDictionary * _Nonnull))success failure:(void (^)(NSString * _Nonnull))failure{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
       [paramentdic setValue:groupID forKey:@"gid"];
       [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
       [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
       [[NetWorkTool shareInstance]requestWithPath:Check_GroupName method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
           if (res.isSuccess) {
               success(res.rawdata);
           }else
           {
               failure(res.message);
           }
       }];
}

+ (void)requestSearchPublicNameWithQuery:(NSString *)query Success:(void (^)(NSDictionary * _Nonnull))success failure:(void (^)(NSString * _Nonnull))failure{
    NSMutableDictionary * paramentdic =[[NSMutableDictionary alloc]init];
       [paramentdic setValue:query forKey:@"query"];
       [paramentdic setValue:[LoginManager shareLoginManager].userModel.token forKey:@"t"];
       [paramentdic setValue:[LoginManager shareLoginManager].userModel.uuid forKey:@"uuid"];
    [[NetWorkTool shareInstance]requestPublicWithPath:Public_query method:HttpRequestPost paramenters:paramentdic completion:^(SLResultModel * _Nonnull res) {
           if (res.isSuccess) {
               success(res.rawdata);
           }else
           {
               failure(res.message);
           }
       }];
}

@end
